package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.assistant.common.vo.BaseVO;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduUnionSchoolDetail.EduUnionSchoolDetailKeyVO;
import com.jwsoft.manager.common.vo.eduUnionSchoolDetail.EduUnionSchoolDetailQueryVO;
import com.jwsoft.manager.common.vo.eduUnionSchoolDetail.EduUnionSchoolDetailVO;
import com.jwsoft.manager.core.integration.EduUnionSchoolDetailIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 户籍跨校联合区明细表网关
 *
 * @author wangtao
 * @since 2022-12-23
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "户籍跨校联合区明细表", description = "户籍跨校联合区明细表")
public class EduUnionSchoolDetailController {

    @Autowired
    public EduUnionSchoolDetailIntegration eduUnionSchoolDetailIntegration;

    @Operation(summary = "户籍跨校联合区明细表分页查询",description = "户籍跨校联合区明细表分页查询")
    @PostMapping(value = "/eduUnionSchoolDetail0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduUnionSchoolDetailVO>> getList(@RequestBody @Validated EduUnionSchoolDetailQueryVO vo) {
        return AppResponse.successData(eduUnionSchoolDetailIntegration.getList(vo));
    }

    @Operation(summary = "户籍跨校联合区明细表根据主键查询详情",description = "户籍跨校联合区明细表根据主键查询详情")
    @PostMapping(value = "/eduUnionSchoolDetail0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduUnionSchoolDetailVO> getById(@RequestBody @Validated EduUnionSchoolDetailKeyVO vo) {
        return AppResponse.successData(eduUnionSchoolDetailIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍跨校联合区明细表新增",description = "户籍跨校联合区明细表新增")
    @PostMapping(value = "/eduUnionSchoolDetail0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduUnionSchoolDetailVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduUnionSchoolDetailVO vo) {
        return AppResponse.successData(eduUnionSchoolDetailIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍跨校联合区明细表修改",description = "户籍跨校联合区明细表修改")
    @PostMapping(value = "/eduUnionSchoolDetail0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduUnionSchoolDetailVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduUnionSchoolDetailVO vo) {
        return AppResponse.successData(eduUnionSchoolDetailIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "户籍跨校联合区明细表删除",description = "户籍跨校联合区明细表删除")
    @PostMapping(value = "/eduUnionSchoolDetail0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduUnionSchoolDetailKeyVO vo) {
        eduUnionSchoolDetailIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

}
